package com.atguign.gulimall.product.web;

import com.atguign.gulimall.product.entity.CategoryEntity;
import com.atguign.gulimall.product.service.CategoryService;
import com.atguign.gulimall.product.service.SkuInfoService;
import com.atguign.gulimall.product.vo.Catalog2Vo;
import com.atguign.gulimall.product.vo.SkuItemVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.logging.Logger;

/**
 * @program: gulimall
 * @description:
 * @author: liuxvru
 * @create: 2024-08-09 19:54
 **/
@Slf4j
@Controller
public class ItemController {

    @Autowired
    CategoryService categoryService;
    @Autowired
    SkuInfoService skuInfoService;
    @GetMapping({"/{skuId}.html"})
    public String skuItem(@PathVariable("skuId")Long skuId,Model model) throws ExecutionException, InterruptedException {
        log.debug("skuId:{}",skuId);
        SkuItemVo skuItemVo= skuInfoService.item(skuId);
        model.addAttribute("item",skuItemVo);
        return "item";
    }
}
